Document 258

The LaTeX chapterbib package

Version: 3.x, 4.x, 5.x - Scientific WorkPlace & Scientific Word

With the chapterbib package, you can create a BibTeX bibliography for each file you include in your master document. If each chapter in the document is included as a separate file, then each chapter can have its own bibliography. Your document can contain multiple small BibTeX bibliographies as well as a comprehensive BibTeX bibliography for the whole. You can also create a bibliography for the whole document, such as a recommended reading list, that is unrelated to cited works. The bibliography items can be cited in more than one bibliography.

Your document requires several changes to use the chapterbib package. Each included file must have its own \bibliographystyle and \bibliography commands, as must the master document if you want a bibliography for the whole document. Generally, to generate the bibliographies you must typeset your document (one pass through LaTeX), run BibTeX on each included file separately, and then typeset your document again (two passes through LaTeX). The more complex your document, the more complex the process. You must typeset compile your document from outside SWP or SW.

Placing bibliographies at the end of each chapter with the chapterbib package

  1. Open the master document that contains your chapters.

  2. Add the chapterbib package to your master document.

  3. Scroll through the document to find any subdocuments in the document. Each subdocument appears as a gray box labeled with the name of the subdocument.

  4. Replace each subdocument object with a TeX field:

    1. In Version 4.0 and later, from the Insert menu, choose Typeset Object and then choose TeX Field.

      or

      In earlier versions, from the Insert menu, choose Field and then choose TeX.

    2. Check the Encapsulated box.

    3. In the entry area, type \include{subdoc} where subdoc is the name of the subdocument you want to include. Don't use the .tex extension; LaTeX adds it automatically.

    4. Choose OK.

  5. If you are creating a comprehensive BibTeX bibliography for the whole document, add a BibTeX field to the master document at the point where the bibliography is to appear.

  6. Save the master document.

  7. For each subdocument that contains citations and will have a seperate bibliography, add a BibTeX field at the point where the bibliography is to appear.

  8. Save each subdocument.

  9. From outside SWP or SW, typeset compile the master document:

    • If creating a DVI file:

    1. From the SWP or SW submenu on the Windows Programs list, choose the TrueTeX Formatter.

    2. Select the file and choose OK.

    • If creating a PDF file using Version 5.x:

    1. Open a command prompt.

    2. Change the default directory to the document directory.

    3. Enter this command line (note the space):

      c:\swp55\tcitex\truetex\runpdflatex filename

    LaTeX generates .aux files for each subdocument included by the master document.

  10. From outside SWP or SW, run BibTeX as necessary on the .aux file for each subdocument and the master document:

    • In Version 4 and later:

      1. Open a command prompt.

      2. Enter these two commands separately to set the environments needed by the BibTeX program to locate the bibliography style and database files (note the space):

        set BSTINPUTS=C:\swp55\TCITeX\bibtex\bst\\

        set BIBINPUTS=C:\swp55\TCITeX\bibtex\bib\\

        changing the program directory as necessary for your installation.

      3. Use the cd command to change the command prompt default directory to the document directory.

      4. Run BibTeX by entering this command (note the space) where filename is the name of a subdocument or master document:

        c:\swp55\TCITeX\web2c\bibtex filename

        changing the program directory as necessary for your installation.

      5. Repeat the above step for all files that have a corresponding .aux files.

    • In Version 3.5:

      1. From the Windows Start menu, choose Run.

      2. In the Open box, type c:\swp35\TCITeX\SWTools\bin\bibtex.exe and choose OK.

        Change the program directory name as necessary.

      3. Specify the .aux file.

      4. Choose Create.

        BibTeX creates a .bbl file.

      5. Choose OK.

    • In Version 3.0:

      1. From the Windows Start menu, choose Run.

      2. In the Open box, type c:\swp30\bibtex.exe and choose OK.

        Change the program directory name as necessary.

      3. Specify the .aux file.

      4. Choose Create.

        BibTeX creates a .bbl file.

      5. Choose OK.

  11. From outside SWP or SW, typeset compile the master document at least twice more (see step 9 above).

  12. The final results can now be viewed.

    • If creating a DVI file, from inside SWP or SW, choose Preview from the Typeset menu.

    • If creating a PDF file using Version 5.x, from inside SWP or SW, choose Preview PDF from the Typeset menu.

Additional commands provide customized entries in a list of citations and multiple bibliographies without using the \include command. With package options you can repeat or gather all chapter bibliography entries at the end of the document, create a bibliography for the entire document, and format the bibliography title.

This package is compatible with the cite and drftcite packages, all installed in the TCITeX/TeX/LaTeX/contrib/cite directory.

Last revised 02/16/06

This document was created with Scientific WorkPlace.